package com.atguigu.gmall.item.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Auther 赵乾坤
 * @Date 2020-12-26 18:02
 */
@Configuration
public class ThreadConfig {

    //懒行为  创建对象并放到Spring容器中
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        return new ThreadPoolExecutor(
                10,
                20,
                60L, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10)
        );
    }
}
